import React from 'react'
import { Mentions } from 'antd';
const { Option } = Mentions;

const MOCK_DATA = {
  '@': ['afc163', 'zombiej', 'yesmeck'],
  '#': ['1.0', '2.0', '3.0'],
  '$': ['100美元', '100人名币', '100英镑'],
};

export default class App extends React.Component {
  state = { prefix: '@', };
  render() {
    return (
      <Mentions
        style={{ width: '100%' }}
        placeholder="input @ to mention people, # to mention tag"
        prefix={Object.keys(MOCK_DATA||{})}
        onSearch={(_, prefix) => this.setState({ prefix })}
      >
        {(MOCK_DATA[this.state.prefix] || []).map(value => (
          <Option key={value} value={value}> {value} </Option>
        ))}
      </Mentions>
    );
  }
}